package com.wuster.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseMapper;
import com.wuster.entity.dto.UserAndClockDTO;
import com.wuster.entity.po.Daka;
import com.wuster.entity.vo.InfoVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


/**
 * 打卡表
 */
@Mapper
public interface DakaMapper extends MPJBaseMapper<Daka> {

    /**
     * 学生打卡记录联合查询
     * @param page
     * @return
     */
    @Select("SELECT a.*, b.user_name from daka a LEFT JOIN user b on a.uid=b.id ")
    Page<UserAndClockDTO> getRecords(Page<UserAndClockDTO> page);


    /**
     * 学生打卡记录联合查询  按名称模糊查询
     * @param page
     * @return
     */
    @Select("SELECT a.*, b.user_name from daka a LEFT JOIN user b on a.uid=b.id WHERE b.user_name like CONCAT('%', #{name}, '%')")
    Page<UserAndClockDTO> getRecordByName(Page<UserAndClockDTO> page, String name);

}
